<?php
	//general settings

if(!defined('WORKING_THROUGH_ADMIN_SCRIPT'))
{
	die;
}

	if (!strcmp($sub, "general"))
	{

		if (isset($_GET["save_successful"])) //show successful save confirmation message
		{
			$smarty->assign("configuration_saved", 1);
		}
		if (isset($_POST["save_general"])) //save system settings
		{
			//general settings
			$f = fopen("./cfg/general.inc.php","w");

			fputs($f,"<?php\n\tdefine('CONF_GENERAL_EMAIL', '".__escape_string($_POST["general_email"])."');\n");
      
      fputs($f,"\tdefine('CONF_DEFAULT_TITLE', '".__escape_string($_POST["default_title"])."');\n");
      
			fputs($f,"\tdefine('CONF_ORDERS_EMAIL', '".__escape_string($_POST["orders_email"])."');\n");

			fputs($f,"?>");

			fclose($f);

			header("Location: admin.php?dpt=conf&sub=general&save_successful=yes");

		}
		//set sub-department template
		$smarty->assign("admin_sub_dpt", "conf_general.tpl.html");
	}
?>